<%@ page import="java.util.List" %>
<%@ page import="top.wuyang.study.javawebjdbc.worknews.TbNews" %>
<%@ page import="top.wuyang.study.javawebjdbc.worknews.TbNewsDAO" %><%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2024/5/20
  Time: 18:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新闻页面</title>
</head>
<body>

<%
    List<TbNews> list = TbNewsDAO.query();
%>

<h1>
    <a href="newsinsert.jsp">添加新闻</a>
</h1>

<table style="width: 80%">
    <thead>
    <tr>
        <th>编号</th>
        <th>标题</th>
        <th>内容</th>
        <th>发布时间</th>
    </tr>
    </thead>

    <tbody>
    <% for (TbNews tbNews : list) {%>
    <tr>
        <td><%=tbNews.getId()%>
        </td>
        <td><%=tbNews.getTitle()%>
        </td>
        <td><%=tbNews.getConnent()%>
        </td>
        <td><%=tbNews.getPublishdate()%>
        </td>
        <td>
            <a href="newsdelete.jsp?id=<%=tbNews.getId()%>">删除</a>
        </td>
    </tr>
    <% } %>
    </tbody>
</table>


</body>
</html>
